//
//  SCNStudyModels.swift
//  ShoucainuSwift
//
//  Created by 王家旭 on 2017/5/12.
//  Copyright © 2017年 Riluee. All rights reserved.
//

import Foundation
import ObjectMapper

class SCNStudyViewModel: NSObject {
    
    class func requestOtherCate(_ block:@escaping ((_ dataresult: [SCNStudyListModels]) -> Void)) -> Void {
        
        SCNRequestManager.postRequest([:], URL: SCNRequestAPI.other().cate) { (response) in
            
            let announcementModels = Mapper<SCNStudyModels>().map(JSONObject: response.result.value)
            
            if let tmp = announcementModels?.dataresult {
                block(tmp)
                
                
            }
        }
        
        
    }
}

class SCNStudyModels: Mappable {
    var dataresult: [SCNStudyListModels]?
    var errmsg: String?
    var status: Int?
    var servertime: Int?
    
    
    
    
    init(){}
    
    required init?(map: Map) {
        mapping(map:map)
    }
    
    func mapping(map: Map) {
        
        dataresult <- map["dataresult"]
        errmsg <- map["errmsg"]
        status <- map["status"]
        servertime <- map["servertime"]
    }

}

class SCNStudyListModels: Mappable {
    
    var logo_url: String?
    var title: String?
    var title_py: String?
    var url: String?
    
    
    
    
    init(){}
    
    required init?(map: Map) {
        mapping(map:map)
    }
    
    func mapping(map: Map) {
        
        
        logo_url <- map["logo_url"]
        title <- map["title"]
        title_py <- map["title_py"]
        url <- map["url"]
    }
    
}
